package com.example.shopp_2301.adapter

import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.Child
import com.example.shopp_2301.R
import com.example.shopp_2301.utils.GlideUtils

class TwoAdapter:BaseQuickAdapter<Child,BaseViewHolder>(R.layout.item_two) {
    var selectId = 534
    override fun convert(holder: BaseViewHolder, item: Child) {
        GlideUtils.loadImage(context,item.extra,holder.getView(R.id.two_iv))
        holder.setText(R.id.two_tv,item.name)
        if(item.id==selectId){
            holder.getView<TextView>(R.id.two_tv).setTextColor(Color.GREEN)
        }else{
            holder.getView<TextView>(R.id.two_tv).setTextColor(Color.BLACK)
        }
    }
    fun setId(id:Int){
        selectId = id
        notifyDataSetChanged()
    }
}